package consys.social.core.bo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Entity is the basic role in the system - It can be user or event
 * The only thing you can be sure is that the uid is filled properly
 * The other properties are filled "as needed"
 * name, photoid and organization are loaded by UserAdapter
 * (this is because these data are not always needed and because we know that
 * these data can be saved separately = that Social Service is only a part of system)
 *
 * @author Petr Kunc
 */
public class Entity implements Serializable {
    private static final long serialVersionUID = 2612998847826070992L;

    private String uid; //uuid
    private List<Entity> followers = new ArrayList<Entity>();
    private List<Entity> following = new ArrayList<Entity>();
    private long followersCount;
    private long followingCount;

    public Entity(String uid) {
        this.uid = uid;
    }

    public long getFollowersCount() {
        return followersCount;
    }

    public void setFollowersCount(long followersCount) {
        this.followersCount = followersCount;
    }

    public List<Entity> getFollowers() {
        return followers;
    }

    public void setFollowers(List<Entity> followers) {
        this.followers = followers;
    }

    public List<Entity> getFollowing() {
        return following;
    }

    public void setFollowing(List<Entity> following) {
        this.following = following;
    }

    public long getFollowingCount() {
        return followingCount;
    }

    public void setFollowingCount(long followingCount) {
        this.followingCount = followingCount;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Entity other = (Entity) obj;
        if ((this.uid == null) ? (other.uid != null) : !this.uid.equals(other.uid)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 37 * hash + (this.uid != null ? this.uid.hashCode() : 0);
        return hash;
    }


}
